﻿#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileInfo>
#include <QWebFrame>
#include <QMessageBox>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

/**
 *	load html page
 *
 * 	@file		[in] file name(relative path)
 */
pem_void_t MainWindow::LoadFile( pem_s8_t* file )
{
    QString		strurl = "file:///";
    strurl += QFileInfo(file).absoluteFilePath();
    QUrl		url( strurl );
    webView()->load( url );
}

/**
 *	get the QWebView object pointer
 *
 * 	return
 * 		!=	NULL	the QWevView object pointer
 * 		==	NULL	failure
 */
QWebView* MainWindow::webView()
{
    return ui->webview;
}
